cc.Class({
    extends: cc.Component,

    properties: {
        btnHead: cc.Button,
        btnBind: cc.Button,
    },
    
    onLoad () {
        this.onUserCanBind(false);
        this.btnBind.node.on('click', this.onBindEvent, this);
        this.btnHead.node.on('click', this.onBindEvent, this);
        cc.Emitter.on(EVENTS.GET_TOKEN, this.onGetToken, this);
    },

    onGetToken() {
        LINK.isGuestLogin ? this.onUserCanBind(true) : this.onUserCanBind(false);
    },

    onBindEvent() {
        cc.Popup.show('public/BindInfoPop');
    },

    onUserCanBind(enable) {
        this.btnBind.node.active = enable;
        this.btnHead.node.active = enable;
    },
});
